﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using NOAH.CMS.Repository;
using NOAH.CMS.Cache;

public class MenuController : Controller
{
    public ViewResult _Top()
    {

        List<BaseCategoryView> cates = new List<BaseCategoryView>();

        List<NewsCategory> allCates = new NewsCategoryCacheLayer().GetAll();
        allCates = allCates.FindAll(p => p.IsTop == true).OrderBy(p => p.Order).ToList();

        foreach (NewsCategory n in allCates)
        {
            cates.Add(n.ConvertFrom());
        }

        List<Subject> subjects = new SubjectCacheLayer().GetAll();
        subjects = subjects.FindAll(p => p.IsOnTopMenu == true).OrderBy(p => p.Order).ToList();

        foreach (Subject n in subjects)
        {
            cates.Add(n.ConvertFrom());
        }

        return View(cates);
    }


}
